package com.example.film.service;

import com.example.film.entity.CinemaSell;
import com.example.film.mapper.CinemaSellMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class CinemaSellServiceImpl implements CinemaSellService{

    @Autowired
    private CinemaSellMapper cinemaSellMapper;

    @Override
    public List<CinemaSell> findCinemaSell() {
        return cinemaSellMapper.findCinemaSell();
    }

    @Override
    public List<CinemaSell> findCinemaSellInfo(Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return cinemaSellMapper.findCinemaSellInfo(startIndex,pageSize);
    }

    @Override
    public List<CinemaSell> findCinemaSellByDate(Date currentDate, Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return cinemaSellMapper.findCinemaSellByDate(currentDate, startIndex, pageSize);
    }

    @Override
    public List<CinemaSell> findCinemaSellByProvince(String province, Integer pageNum, Integer pageSize) {
        int startIndex = (pageNum - 1) * pageSize;
        return cinemaSellMapper.findCinemaSellByProvince(province, startIndex, pageSize);
    }

    @Override
    public List<CinemaSell> findDaySumInfo(Date currentDate) {
        return cinemaSellMapper.findDaySumInfo(currentDate);
    }
}
